#include <iostream>
using namespace std;
const int &MAX = 100000;
int parent(int i) {return i / 2;}
int left(int i) {return i * 2;}
int right(int i) {return 2 * i + 1;}

int main() {
    int h, i, A[MAX + 1];

    cin >> h;
    for (i = 1; i <= h; ++i) cin >> A[i];

    for (i = 1; i <= h; ++i) {
        cout << "node " << i << " key = " << A[i] << ", ";
        if (parent(i) >= 1) cout << "parent key = " << A[parent(i)] << ", ";
        if (left(i) <= h) cout << "left key = " << A[left(i)] << ", ";
        if (right(i) <= h) cout << "right key = " << A[right(i)] << ", ";
        cout << endl;
    }

    return 0;
}